<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Circle Processor | ElasticSearch 7.7 权威指南中文版</title>
	<meta name="keywords" content="ElasticSearch 权威指南中文版, elasticsearch 7, es7, 实时数据分析，实时数据检索" />
    <meta name="description" content="ElasticSearch 权威指南中文版, elasticsearch 7, es7, 实时数据分析，实时数据检索" />
    <!-- Give IE8 a fighting chance -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
	<link rel="stylesheet" type="text/css" href="../static/styles.css" />
	<script>
	var _link = 'ingest-circle-processor.html';
    </script>
</head>
<body>
<div class="main-container">
    <section id="content">
        <div class="content-wrapper">
            <section id="guide" lang="zh_cn">
                <div class="container">
                    <div class="row">
                        <div class="col-xs-12 col-sm-8 col-md-8 guide-section">
                            <div style="color:gray; word-break: break-all; font-size:12px;">原英文版地址: <a href="https://www.elastic.co/guide/en/elasticsearch/reference/7.7/ingest-circle-processor.html" rel="nofollow" target="_blank">https://www.elastic.co/guide/en/elasticsearch/reference/7.7/ingest-circle-processor.html</a>, 原文档版权归 www.elastic.co 所有<br/>本地英文版地址: <a href="../en/ingest-circle-processor.html" rel="nofollow" target="_blank">../en/ingest-circle-processor.html</a></div>
                        <!-- start body -->
                  <div class="page_header">
<strong>重要</strong>: 此版本不会发布额外的bug修复或文档更新。最新信息请参考 <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html" rel="nofollow">当前版本文档</a>。
</div>
<div id="content">
<div class="breadcrumbs">
<span class="breadcrumb-link"><a href="index.html">Elasticsearch Guide [7.7]</a></span>
»
<span class="breadcrumb-link"><a href="ingest.html">Ingest node</a></span>
»
<span class="breadcrumb-link"><a href="ingest-processors.html">Processors</a></span>
»
<span class="breadcrumb-node">Circle Processor</span>
</div>
<div class="navheader">
<span class="prev">
<a href="bytes-processor.html">« Bytes Processor</a>
</span>
<span class="next">
<a href="convert-processor.html">Convert Processor »</a>
</span>
</div>
<div class="section xpack">
<div class="titlepage"><div><div>
<h2 class="title">
<a id="ingest-circle-processor"></a>Circle Processor<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/ingest/processors/circle.asciidoc">edit</a><a class="xpack_tag" href="https://www.elastic.co/subscriptions"></a>
</h2>
</div></div></div>
<p>Converts circle definitions of shapes to regular polygons which approximate them.</p>
<div class="table">
<a id="circle-processor-options"></a>
<p class="title"><strong>Table 34. Circle Processor Options</strong></p>
<div class="table-contents">
<table border="1" cellpadding="4px" summary="Circle Processor Options">
<colgroup>
<col class="col_1">
<col class="col_2">
<col class="col_3">
<col class="col_4">
</colgroup>
<thead>
<tr>
<th align="left" valign="top">Name</th>
<th align="left" valign="top">Required</th>
<th align="left" valign="top">Default</th>
<th align="left" valign="top">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left" valign="top"><p><code class="literal">field</code></p></td>
<td align="left" valign="top"><p>yes</p></td>
<td align="left" valign="top"><p>-</p></td>
<td align="left" valign="top"><p>The string-valued field to trim whitespace from</p></td>
</tr>
<tr>
<td align="left" valign="top"><p><code class="literal">target_field</code></p></td>
<td align="left" valign="top"><p>no</p></td>
<td align="left" valign="top"><p><code class="literal">field</code></p></td>
<td align="left" valign="top"><p>The field to assign the polygon shape to, by default <code class="literal">field</code> is updated in-place</p></td>
</tr>
<tr>
<td align="left" valign="top"><p><code class="literal">ignore_missing</code></p></td>
<td align="left" valign="top"><p>no</p></td>
<td align="left" valign="top"><p><code class="literal">false</code></p></td>
<td align="left" valign="top"><p>If <code class="literal">true</code> and <code class="literal">field</code> does not exist, the processor quietly exits without modifying the document</p></td>
</tr>
<tr>
<td align="left" valign="top"><p><code class="literal">error_distance</code></p></td>
<td align="left" valign="top"><p>yes</p></td>
<td align="left" valign="top"><p>-</p></td>
<td align="left" valign="top"><p>The difference between the resulting inscribed distance from center to side and the circle’s radius (measured in meters for <code class="literal">geo_shape</code>, unit-less for <code class="literal">shape</code>)</p></td>
</tr>
<tr>
<td align="left" valign="top"><p><code class="literal">shape_type</code></p></td>
<td align="left" valign="top"><p>yes</p></td>
<td align="left" valign="top"><p>-</p></td>
<td align="left" valign="top"><p>which field mapping type is to be used when processing the circle: <code class="literal">geo_shape</code> or <code class="literal">shape</code></p></td>
</tr>
<tr>
<td align="left" valign="top"><p><code class="literal">if</code></p></td>
<td align="left" valign="top"><p>no</p></td>
<td align="left" valign="top"><p>-</p></td>
<td align="left" valign="top"><p>Conditionally execute this processor.</p></td>
</tr>
<tr>
<td align="left" valign="top"><p><code class="literal">on_failure</code></p></td>
<td align="left" valign="top"><p>no</p></td>
<td align="left" valign="top"><p>-</p></td>
<td align="left" valign="top"><p>Handle failures for this processor. See <a class="xref" href="handling-failure-in-pipelines.html" title="Handling Failures in Pipelines"><em>Handling Failures in Pipelines</em></a>.</p></td>
</tr>
<tr>
<td align="left" valign="top"><p><code class="literal">ignore_failure</code></p></td>
<td align="left" valign="top"><p>no</p></td>
<td align="left" valign="top"><p><code class="literal">false</code></p></td>
<td align="left" valign="top"><p>Ignore failures for this processor. See <a class="xref" href="handling-failure-in-pipelines.html" title="Handling Failures in Pipelines"><em>Handling Failures in Pipelines</em></a>.</p></td>
</tr>
<tr>
<td align="left" valign="top"><p><code class="literal">tag</code></p></td>
<td align="left" valign="top"><p>no</p></td>
<td align="left" valign="top"><p>-</p></td>
<td align="left" valign="top"><p>An identifier for this processor. Useful for debugging and metrics.</p></td>
</tr>
</tbody>
</table>
</div>
</div>
<p><span class="image"><img src="../static/images/spatial/error_distance.png" alt="error distance"></span></p>
<div class="pre_wrapper lang-console">
<pre class="programlisting prettyprint lang-console">PUT circles
{
  "mappings": {
    "properties": {
      "circle": {
        "type": "geo_shape"
      }
    }
  }
}

PUT _ingest/pipeline/polygonize_circles
{
    "description": "translate circle to polygon",
    "processors": [
      {
        "circle": {
          "field": "circle",
          "error_distance": 28.0,
          "shape_type": "geo_shape"
        }
      }
    ]
}</pre>
</div>
<div class="console_widget" data-snippet="snippets/1081.console"></div>
<p>Using the above pipeline, we can attempt to index a document into the <code class="literal">circles</code> index.
The circle can be represented as either a WKT circle or a GeoJSON circle. The resulting
polygon will be represented and indexed using the same format as the input circle. WKT will
be translated to a WKT polygon, and GeoJSON circles will be translated to GeoJSON polygons.</p>
<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="_example_circle_defined_in_well_known_text"></a>Example: Circle defined in Well Known Text<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/ingest/processors/circle.asciidoc">edit</a>
</h3>
</div></div></div>
<p>In this example a circle defined in WKT format is indexed</p>
<div class="pre_wrapper lang-console">
<pre class="programlisting prettyprint lang-console">PUT circles/_doc/1?pipeline=polygonize_circles
{
  "circle": "CIRCLE (30 10 40)"
}

GET circles/_doc/1</pre>
</div>
<div class="console_widget" data-snippet="snippets/1082.console"></div>
<p>The response from the above index request:</p>
<div class="pre_wrapper lang-console-result">
<pre class="programlisting prettyprint lang-console-result">{
  "found": true,
  "_index": "circles",
  "_type": "_doc",
  "_id": "1",
  "_version": 1,
  "_seq_no": 22,
  "_primary_term": 1,
  "_source": {
    "circle": "POLYGON ((30.000365257263184 10.0, 30.000111397193788 10.00034284530941, 29.999706043744222 10.000213571721195, 29.999706043744222 9.999786428278805, 30.000111397193788 9.99965715469059, 30.000365257263184 10.0))"
  }
}</pre>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="_example_circle_defined_in_geojson"></a>Example: Circle defined in GeoJSON<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/ingest/processors/circle.asciidoc">edit</a>
</h3>
</div></div></div>
<p>In this example a circle defined in GeoJSON format is indexed</p>
<div class="pre_wrapper lang-console">
<pre class="programlisting prettyprint lang-console">PUT circles/_doc/2?pipeline=polygonize_circles
{
  "circle": {
    "type": "circle",
    "radius": "40m",
    "coordinates": [30, 10]
  }
}

GET circles/_doc/2</pre>
</div>
<div class="console_widget" data-snippet="snippets/1083.console"></div>
<p>The response from the above index request:</p>
<div class="pre_wrapper lang-console-result">
<pre class="programlisting prettyprint lang-console-result">{
  "found": true,
  "_index": "circles",
  "_type": "_doc",
  "_id": "2",
  "_version": 1,
  "_seq_no": 22,
  "_primary_term": 1,
  "_source": {
    "circle": {
      "coordinates": [
        [
          [30.000365257263184, 10.0],
          [30.000111397193788, 10.00034284530941],
          [29.999706043744222, 10.000213571721195],
          [29.999706043744222, 9.999786428278805],
          [30.000111397193788, 9.99965715469059],
          [30.000365257263184, 10.0]
        ]
      ],
      "type": "Polygon"
    }
  }
}</pre>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="_notes_on_accuracy"></a>Notes on Accuracy<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/ingest/processors/circle.asciidoc">edit</a>
</h3>
</div></div></div>
<p>Accuracy of the polygon that represents the circle is defined as <code class="literal">error_distance</code>. The smaller this
difference is, the closer to a perfect circle the polygon is.</p>
<p>Below is a table that aims to help capture how the radius of the circle affects the resulting number of sides
of the polygon given different inputs.</p>
<p>The minimum number of sides is <code class="literal">4</code> and the maximum is <code class="literal">1000</code>.</p>
<div class="table">
<a id="circle-processor-accuracy"></a>
<p class="title"><strong>Table 35. Circle Processor Accuracy</strong></p>
<div class="table-contents">
<table border="1" cellpadding="4px" summary="Circle Processor Accuracy">
<colgroup>
<col class="col_1">
<col class="col_2">
<col class="col_3">
</colgroup>
<thead>
<tr>
<th align="left" valign="top">error_distance</th>
<th align="left" valign="top">radius in meters</th>
<th align="left" valign="top">number of sides of polygon</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left" valign="top"><p>1.00</p></td>
<td align="left" valign="top"><p>1.0</p></td>
<td align="left" valign="top"><p>4</p></td>
</tr>
<tr>
<td align="left" valign="top"><p>1.00</p></td>
<td align="left" valign="top"><p>10.0</p></td>
<td align="left" valign="top"><p>14</p></td>
</tr>
<tr>
<td align="left" valign="top"><p>1.00</p></td>
<td align="left" valign="top"><p>100.0</p></td>
<td align="left" valign="top"><p>45</p></td>
</tr>
<tr>
<td align="left" valign="top"><p>1.00</p></td>
<td align="left" valign="top"><p>1000.0</p></td>
<td align="left" valign="top"><p>141</p></td>
</tr>
<tr>
<td align="left" valign="top"><p>1.00</p></td>
<td align="left" valign="top"><p>10000.0</p></td>
<td align="left" valign="top"><p>445</p></td>
</tr>
<tr>
<td align="left" valign="top"><p>1.00</p></td>
<td align="left" valign="top"><p>100000.0</p></td>
<td align="left" valign="top"><p>1000</p></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>

</div>
<div class="navfooter">
<span class="prev">
<a href="bytes-processor.html">« Bytes Processor</a>
</span>
<span class="next">
<a href="convert-processor.html">Convert Processor »</a>
</span>
</div>
</div>

                  <!-- end body -->
                        </div>
                        <div class="col-xs-12 col-sm-4 col-md-4" id="right_col">
                        
                        </div>
                    </div>
                </div>
            </section>
        </div>
    </section>
</div>
<script src="../static/cn.js"></script>
</body>
</html>